package basic.courseLearn09.problem;

import org.junit.Test;

//数字序列转化为字符串，0-25 ==> abc...
public class NumListToString {

    @Test
    public void test(){
        int[] nums = {1,1,1};
        System.out.println(numListToString(nums,0));
    }


    /**
     * 数字序列转化为字符串，0-25 ==> abc...
     * @param nums 数字序列
     * @param i 当前位置
     * @return 方案数目
     */
    public int numListToString(int[] nums,int i) {
        //1. 递归终止条件
        if (i >= nums.length-1){
            return 1;
        }
        //2. 分条件判断
        if (nums[i] == 0){
            return numListToString(nums,i+1);
        }else if (nums[i]==1){
            return numListToString(nums,i+1)+numListToString(nums,i+2);
        } else if (nums[i] == 2) {
            if (nums[i+1] <= 5 && i+1<=nums.length-1){
                return numListToString(nums,i+1)+numListToString(nums,i+2);
            }else{
                return numListToString(nums,i+1);
            }
        }else {
            return numListToString(nums,i+1);
        }

    }



}
